module(
    name = "rabbitmq-server",
    version = "3.10.0",
)

bazel_dep(
    name = "rules_pkg",
    version = "0.5.1",
)

bazel_dep(
    name = "bazel_skylib",
    version = "1.2.0",
)

bazel_dep(
    name = "rules_cc",
    version = "0.0.1",
)

bazel_dep(name = "rules_erlang", version = "3.2.0")

erlang_package = use_extension(
    "@rules_erlang//bzlmod:extensions.bzl",
    "erlang_package",
)

erlang_package.hex_package(
    name = "accept",
    version = "0.3.5",
    sha256 = "11b18c220bcc2eab63b5470c038ef10eb6783bcb1fcdb11aa4137defa5ac1bb8",
)

erlang_package.hex_package(
    name = "aten",
    version = "0.5.7",
    sha256 = "8b623c8be27b59a911d16ab0af41777b504c147bc0d60a29015fab58321c04b0",
)

erlang_package.hex_package(
    name = "base64url",
    version = "1.0.1",
    sha256 = "f9b3add4731a02a9b0410398b475b33e7566a695365237a6bdee1bb447719f5c",
)

erlang_package.hex_package(
    name = "cowboy",
    version = "2.8.0",
    sha256 = "4643e4fba74ac96d4d152c75803de6fad0b3fa5df354c71afdd6cbeeb15fac8a",
)

erlang_package.hex_package(
    name = "cowlib",
    version = "2.9.1",
    sha256 = "e4175dc240a70d996156160891e1c62238ede1729e45740bdd38064dad476170",
)

erlang_package.hex_package(
    name = "credentials_obfuscation",
    version = "3.1.0",
    sha256 = "04884e62b1c6cdfba999d4d6b3e99bc0a59d5e439517bc5c01767255afb7b778",
)

erlang_package.git_package(
    repository = "extend/ct_helper",
    branch = "master",
)

erlang_package.hex_package(
    name = "cuttlefish",
    version = "3.0.1",
    sha256 = "3feff3ae4ed1f0ca6df87ac89235068fbee9242ee85d2ac17fb1b8ce0e30f1a6",
)

erlang_package.hex_package(
    name = "eetcd",
    version = "0.3.6",
    sha256 = "66493bfd6698c1b6baa49679034c3def071ff329961ca1aa7b1dee061c2809af",
    build_file_content = """load("@rules_erlang//:erlang_app.bzl", "erlang_app")

erlang_app(
    app_name = "eetcd",
    erlc_opts = [
        "+deterministic",
        "+debug_info",
    ],
    runtime_deps = [
        "@gun//:erlang_app",
    ],
)
""",
)

erlang_package.git_package(
    repository = "rabbitmq/emqttc",
    branch = "remove-logging",
)

erlang_package.hex_package(
    name = "enough",
    version = "0.1.0",
    sha256 = "0460c7abda5f5e0ea592b12bc6976b8a5c4b96e42f332059cd396525374bf9a1",
)

erlang_package.hex_package(
    name = "gen_batch_server",
    version = "0.8.7",
    sha256 = "94a49a528486298b009d2a1b452132c0a0d68b3e89d17d3764cb1ec879b7557a",
)

erlang_package.hex_package(
    name = "gun",
    version = "1.3.3",
    sha256 = "3106ce167f9c9723f849e4fb54ea4a4d814e3996ae243a1c828b256e749041e0",
)

erlang_package.git_package(
    name = "inet_tcp_proxy_dist",
    repository = "rabbitmq/inet_tcp_proxy",
    branch = "master",
)

erlang_package.git_package(
    name = "jose",
    repository = "michaelklishin/erlang-jose",
    commit = "5d0e927fdaac25c95890b1fc15c7d0f741898acf",
)

erlang_package.hex_package(
    name = "thoas",
    version = "0.3.0",
    sha256 = "b8e1f8c8fad317c0b75239a9234cb093de1fb8be7ba3e41433ff80a0b3353973",
)

erlang_package.git_package(
    repository = "eproxus/meck",
    branch = "master",
)

erlang_package.hex_package(
    name = "observer_cli",
    version = "1.7.3",
    sha256 = "a41b6d3e11a3444e063e09cc225f7f3e631ce14019e5fbcaebfda89b1bd788ea",
)

erlang_package.git_package(
    repository = "rabbitmq/osiris",
    branch = "main",
    patch_cmds = ["""VERSION=$(git rev-parse HEAD)
echo "Injecting ${VERSION} into Makefile..."
sed -i"_orig" -E '/PROJECT_VERSION/ s/[0-9]+\\.[0-9]+\\.[0-9]+/'${VERSION}'/' Makefile
echo "Injecting ${VERSION} into BUILD.bazel..."
sed -i"_orig" -E '/VERSION/ s/[0-9]+\\.[0-9]+\\.[0-9]+/'${VERSION}'/' BUILD.bazel
""",
"""sed -i"_orig2" -E 's/ct_sharded\\.bzl/ct.bzl/' BUILD.bazel
"""],
)

erlang_package.hex_package(
    name = "prometheus",
    version = "4.9.0",
    sha256 = "026bd40f952c3ffc45aa6a0673602f800ff219a81c63b1c4683d2b7d8a780c2b",
    build_file_content = """load("@rules_erlang//:erlang_app.bzl", "erlang_app")

erlang_app(
    app_name = "prometheus",
    erlc_opts = [
        "+deterministic",
        "+debug_info",
    ],
    deps = [
        "@quantile_estimator//:erlang_app",
    ],
)
""",
)

erlang_package.git_package(
    repository = "manopapad/proper",
    branch = "master",
)

erlang_package.hex_package(
    name = "quantile_estimator",
    version = "0.2.1",
    sha256 = "282a8a323ca2a845c9e6f787d166348f776c1d4a41ede63046d72d422e3da946",
)

erlang_package.git_package(
    repository = "rabbitmq/ra",
    branch = "main",
    patch_cmds = ["""
VERSION=$(git rev-parse HEAD)
echo "Injecting ${VERSION} into ra.app.src..."
sed -i"_orig" "/vsn,/ s/2\\.[0-9]\\.[0-9]/${VERSION}/" src/ra.app.src
"""],
)

erlang_package.hex_package(
    name = "ranch",
    version = "2.1.0",
    sha256 = "244ee3fa2a6175270d8e1fc59024fd9dbc76294a321057de8f803b1479e76916",
)

erlang_package.hex_package(
    name = "recon",
    version = "2.5.2",
    sha256 = "2c7523c8dee91dff41f6b3d63cba2bd49eb6d2fe5bf1eec0df7f87eb5e230e1c",
)

erlang_package.hex_package(
    name = "redbug",
    version = "2.0.7",
    sha256 = "3624feb7a4b78fd9ae0e66cc3158fe7422770ad6987a1ebf8df4d3303b1c4b0c",
)

erlang_package.hex_package(
    name = "seshat",
    version = "0.3.2",
    sha256 = "20d820acbeef9d07298ee863d0c9d06f8e620acba100939ebb2925e4d6b0dfc7",
)

erlang_package.hex_package(
    name = "stdout_formatter",
    version = "0.2.4",
    sha256 = "51f1df921b0477275ea712763042155dbc74acc75d9648dbd54985c45c913b29",
)

erlang_package.git_package(
    repository = "schlagert/syslog",
    tag = "4.0.0",
)

erlang_package.hex_package(
    name = "sysmon_handler",
    version = "1.3.0",
    sha256 = "922cf0dd558b9fdb1326168373315b52ed6a790ba943f6dcbd9ee22a74cebdef",
)

erlang_package.hex_package(
    name = "systemd",
    version = "0.6.1",
    sha256 = "8ec5ed610a5507071cdb7423e663e2452a747a624bb8a58582acd9491ccad233",
    build_file_content = """load("@rules_erlang//:erlang_app.bzl", "erlang_app")

erlang_app(
    app_name = "systemd",
    erlc_opts = [
        "+deterministic",
        "+debug_info",
    ],
    deps = [
        "@enough//:erlang_app",
    ],
)
""",
)

use_repo(
    erlang_package,
    "accept",
    "aten",
    "base64url",
    "cowboy",
    "cowlib",
    "credentials_obfuscation",
    "ct_helper",
    "cuttlefish",
    "eetcd",
    "emqttc",
    "gen_batch_server",
    "gun",
    "inet_tcp_proxy_dist",
    "jose",
    "meck",
    "observer_cli",
    "osiris",
    "prometheus",
    "proper",
    "ra",
    "ranch",
    "recon",
    "redbug",
    "seshat",
    "stdout_formatter",
    "syslog",
    "sysmon_handler",
    "systemd",
    "thoas",
    "trust_store_http",
)

rbe = use_extension(
    "//bazel/bzlmod:extensions.bzl",
    "rbe",
)

rbe.git_repository(
    remote = "https://github.com/rabbitmq/rbe-erlang-platform.git",
    branch = "linux-rbe",
)

use_repo(
    rbe,
    "rbe",
)

secondary_umbrella = use_extension(
    "//bazel/bzlmod:extensions.bzl",
    "secondary_umbrella",
)

use_repo(
    secondary_umbrella,
    "rabbitmq-server-generic-unix-3.10",
)
